package com.gqz.patrol.entity;

import com.alibaba.fastjson.annotation.JSONField;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.baomidou.mybatisplus.core.toolkit.support.SFunction;
import com.fasterxml.jackson.annotation.JsonFormat;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import org.springframework.format.annotation.DateTimeFormat;

import java.io.Serializable;
import java.util.Date;
import java.util.HashMap;
import java.util.Map;


/**
 * @ClassName EnStockEquipDefectEntity
 * @Description 能源-盘点/巡视任务设备缺陷表
 */


@Data
@AllArgsConstructor
@NoArgsConstructor
@TableName(value = "T_EN_STOCK_EQUIP_DEFECT", schema = "bs_defects")
public class EnStockEquipDefectEntity implements Serializable {

    /**
     * 主键标识
     */
    @TableId
    private String id;

    /**
     * 任务编号
     */
    @TableField(value = "TASK_NO")
    private String taskNo;

    /**
     * 缺陷设备编码
     */
    @TableField(value = "EQUIP_NO")
    private String equipNo;

    /**
     * 缺陷设备
     */
    @TableField(value = "EQUIP_NAME")
    private String equipName;

    /**
     * 设备类型编码
     */
    @TableField(value = "EQUIP_TYPE_NO")
    private String equipTypeNo;

    /**
     * 设备类型
     */
    @TableField(value = "EQUIP_TYPE_NAME")
    private String equipTypeName;

    /**
     * 缺陷地点
     */
    @TableField(value = "DEFECT_ADDRESS")
    private String defectAddress;

    /**
     * 缺陷部位
     */
    @TableField(value = "DEFECT_PARTS")
    private String defectParts;

    /**
     * 部件名称
     */
    @TableField(value = "PART_NAME")
    private String partName;

    /**
     * 缺陷描述
     */
    @TableField(value = "DEFECT_DESCRIPTION")
    private String defectDescription;

    /**
     * 现场是否已处理
     */
    @TableField(value = "IS_HANDLE")
    private String isHandle;

    /**
     * 是否删除
     */
    @TableField(value = "IS_DEL")
    private String isDel;

    /**
     * 创建人
     */
    @TableField(value = "CREATOR")
    private String creator;

    /**
     * 创建时间
     */
    @TableField(value = "CREAT_TIME")
    @JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd HH:mm:ss")
    @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    @JSONField(name = "creatTime", format = "yyyy-MM-dd HH:mm:ss")
    private Date creatTime;

    /**
     * 缺陷图片IDS
     */
    @TableField(value = "DEFECT_PICTURE_IDS")
    private String defectPictureIds;

    /**
     * 现场图片IDS
     */
    @TableField(value = "SITE_PICTURE_IDS")
    private String sitePictureIds;

    /**
     * 缺陷状态码 1-创建 2-审核通过（未处理） 3-审核不通过  20-处理中  100-已处理
     */
    @TableField(value = "DEFECT_STATUS_CODE")
    private String defectStatusCode;

    /**
     * 缺陷状态名称 创建 审核通过（未处理） 审核不通过  处理中   已处理
     */
    @TableField(value = "DEFECT_STATUS_NAME")
    private String defectStatusName;

    /**
     * 隐患类型编码
     */
    @TableField(value = "DANGER_TYPE_NO")
    private String dangerTypeNo;

    /**
     * 隐患类型
     */
    @TableField(value = "DANGER_TYPE_NAME")
    private String dangerTypeName;

    /**
     * 隐患分类编码
     */
    @TableField(value = "DANGER_CLASS_NO")
    private String dangerClassNo;

    /**
     * 隐患分类
     */
    @TableField(value = "DANGER_CLASS_NAME")
    private String dangerClassName;

    /**
     * 隐患性质编码
     */
    @TableField(value = "DANGER_NATURE_NO")
    private String dangerNatureNo;

    /**
     * 隐患性质
     */
    @TableField(value = "DANGER_NATURE_NAME")
    private String dangerNatureName;

    /**
     * 模块ID(0001为盘点, 0002为巡视, 0003为消缺)
     */
    @TableField(value = "EQUIP_DEFECT_MODEL")
    private String equipDefectModel;

    /**
     * 类型ID(1为缺陷 2为隐患)
     */
    @TableField(value = "EQUIP_DEFECT_TYPE")
    private String equipDefectType;

    /**
     * 工单名称
     */
    @TableField(value = "TASK_NAME")
    private String taskName;

    /**
     * 工单来源 （1是app创建 2是平台创建 )
     */
    @TableField(value = "TASK_SOURCE_NO")
    private String taskSourceNo;

    /**
     * 缺陷名称/隐患名称
     */
    @TableField(value = "DEFECT_NAME")
    private String defectName;

    /**
     * 单位名称编码
     */
    @TableField(value = "UNIT_NO")
    private String unitNo;

    /**
     * 单位名称
     */
    @TableField(value = "UNIT_NAME")
    private String unitName;

    /**
     * 库房名称编码
     */
    @TableField(value = "KF_NO")
    private String kfNo;

    /**
     * 库房名称
     */
    @TableField(value = "KF_NAME")
    private String kfName;

    /**
     * 班组名称编码
     */
    @TableField(value = "TEAM_NO")
    private String teamNo;

    /**
     * 班组名称
     */
    @TableField(value = "TEAM_NAME")
    private String teamName;

    /**
     * 机房名称编码
     */
    @TableField(value = "JF_NO")
    private String jfNo;

    /**
     * 机房名称
     */
    @TableField(value = "JF_NAME")
    private String jfName;

    /**
     * 物资类别编码
     */
    @TableField(value = "MATERIAL_TYPE_NO")
    private String materialTypeNo;

    /**
     * 物资类别
     */
    @TableField(value = "MATERIAL_TYPE_NAME")
    private String materialTypeName;

    /**
     * 缺陷隐患是否仍存在 (1.存在2.不存在)
     */
    @TableField(value = "IS_EXIT")
    private String isExit;

    /**
     * 消缺前照片
     */
    @TableField(value = "BEFORE_PICTURE_IDS")
    private String beforePictureIds;

    /**
     * 消缺中照片
     */
    @TableField(value = "IN_PICTURE_IDS")
    private String inPictureIds;

    /**
     * 消缺后照片
     */
    @TableField(value = "AFTER_PICTURE_IDS")
    private String afterPictureIds;

    /**
     * 处理方法
     */
    @TableField(value = "DEAL_METHOD")
    private String dealMethod;

    /**
     * 备注
     */
    @TableField(value = "REMARK")
    private String remark;

    /**
     * 处理隐患、缺陷工单编号
     */
    @TableField(value = "HANDLE_TASK_NO")
    private String handleTaskNo;

    /**
     * 处理隐患、缺陷工单名称
     */
    @TableField(value = "HANDLE_TASK_NAME")
    private String handleTaskName;

    /**
     * 模块名称(盘点, 巡视, 消缺)
     */
    @TableField(value = "EQUIP_DEFECT_MODEL_NAME")
    private String equipDefectModelName;

    /**
     * 类型ID(缺陷 隐患)
     */
    @TableField(value = "EQUIP_DEFECT_TYPE_NAME")
    private String equipDefectTypeName;

    /**
     * 工单来源 （app创建 平台创建 )
     */
    @TableField(value = "TASK_SOURCE_NAME")
    private String taskSourceName;

    /**
     * 处理结果
     */
    @TableField(value = "HANDLE_RESULT")
    private String handleResult;

    /**
     * 未处理原因
     */
    @TableField(value = "NO_HANDLE_REASON")
    private String noHandleReason;

    private static Map<String, SFunction<EnStockEquipDefectEntity, ?>> map;

    static {
        map = new HashMap<>();
        map.put("id", EnStockEquipDefectEntity::getId);
        map.put("taskNo", EnStockEquipDefectEntity::getTaskNo);
        map.put("equipNo", EnStockEquipDefectEntity::getEquipNo);
        map.put("equipName", EnStockEquipDefectEntity::getEquipName);
        map.put("equipTypeNo", EnStockEquipDefectEntity::getEquipTypeNo);
        map.put("equipTypeName", EnStockEquipDefectEntity::getEquipTypeName);
        map.put("defectAddress", EnStockEquipDefectEntity::getDefectAddress);
        map.put("defectParts", EnStockEquipDefectEntity::getDefectParts);
        map.put("partName", EnStockEquipDefectEntity::getPartName);
        map.put("defectDescription", EnStockEquipDefectEntity::getDefectDescription);
        map.put("isHandle", EnStockEquipDefectEntity::getIsHandle);
        map.put("isDel", EnStockEquipDefectEntity::getIsDel);
        map.put("creator", EnStockEquipDefectEntity::getCreator);
        map.put("creatTime", EnStockEquipDefectEntity::getCreatTime);
        map.put("defectPictureIds", EnStockEquipDefectEntity::getDefectPictureIds);
        map.put("sitePictureIds", EnStockEquipDefectEntity::getSitePictureIds);
        map.put("defectStatusCode", EnStockEquipDefectEntity::getDefectStatusCode);
        map.put("defectStatusName", EnStockEquipDefectEntity::getDefectStatusName);
        map.put("dangerTypeNo", EnStockEquipDefectEntity::getDangerTypeNo);
        map.put("dangerTypeName", EnStockEquipDefectEntity::getDangerTypeName);
        map.put("dangerClassNo", EnStockEquipDefectEntity::getDangerClassNo);
        map.put("dangerClassName", EnStockEquipDefectEntity::getDangerClassName);
        map.put("dangerNatureNo", EnStockEquipDefectEntity::getDangerNatureNo);
        map.put("dangerNatureName", EnStockEquipDefectEntity::getDangerNatureName);
        map.put("equipDefectModel", EnStockEquipDefectEntity::getEquipDefectModel);
        map.put("equipDefectType", EnStockEquipDefectEntity::getEquipDefectType);
        map.put("taskName", EnStockEquipDefectEntity::getTaskName);
        map.put("taskSourceNo", EnStockEquipDefectEntity::getTaskSourceNo);
        map.put("defectName", EnStockEquipDefectEntity::getDefectName);
        map.put("unitNo", EnStockEquipDefectEntity::getUnitNo);
        map.put("unitName", EnStockEquipDefectEntity::getUnitName);
        map.put("kfNo", EnStockEquipDefectEntity::getKfNo);
        map.put("kfName", EnStockEquipDefectEntity::getKfName);
        map.put("teamNo", EnStockEquipDefectEntity::getTeamNo);
        map.put("teamName", EnStockEquipDefectEntity::getTeamName);
        map.put("jfNo", EnStockEquipDefectEntity::getJfNo);
        map.put("jfName", EnStockEquipDefectEntity::getJfName);
        map.put("materialTypeNo", EnStockEquipDefectEntity::getMaterialTypeNo);
        map.put("materialTypeName", EnStockEquipDefectEntity::getMaterialTypeName);
        map.put("isExit", EnStockEquipDefectEntity::getIsExit);
        map.put("beforePictureIds", EnStockEquipDefectEntity::getBeforePictureIds);
        map.put("inPictureIds", EnStockEquipDefectEntity::getInPictureIds);
        map.put("afterPictureIds", EnStockEquipDefectEntity::getAfterPictureIds);
        map.put("dealMethod", EnStockEquipDefectEntity::getDealMethod);
        map.put("remark", EnStockEquipDefectEntity::getRemark);
        map.put("handleTaskNo", EnStockEquipDefectEntity::getHandleTaskNo);
        map.put("handleTaskName", EnStockEquipDefectEntity::getHandleTaskName);
        map.put("equipDefectModelName", EnStockEquipDefectEntity::getEquipDefectModelName);
        map.put("equipDefectTypeName", EnStockEquipDefectEntity::getEquipDefectTypeName);
        map.put("taskSourceName", EnStockEquipDefectEntity::getTaskSourceName);
        map.put("handleResult", EnStockEquipDefectEntity::getHandleResult);
        map.put("noHandleReason", EnStockEquipDefectEntity::getNoHandleReason);

    }

    public static SFunction<EnStockEquipDefectEntity, ?> genColumnSFunction(String column) {
        return map.get(column);
    }


}
